


#include "HeaderFiles.h"
#include "wallsensor_lookup.h"

const float32_t WALL_SENSOR_Table[2][MAX_TABLE_AMOUNT] =
{
    //  K (0~40)
    {
		0,		0,		    -1.354637218f,		-0.657960288f,		-0.386503586f,
		-0.253391166f,		-0.178501936f,		-0.132301082f,		-0.10184314f,
		-0.080730919f,		-0.065510413f,		-0.054184864f,		-0.045535399f,
		-0.038784189f,		-0.033416155f,		-0.029079372f,		-0.025526848f,
		-0.022581155f,		-0.020112216f,		-0.018022933f,		-0.016239659f,
		-0.014705725f,		-0.013376962f,		-0.012218533f,		-0.011202676f,
		-0.010307041f,		-0.009513483f,		-0.008807141f,		-0.008175758f,
		-0.007609149f,		-0.007098795f,		-0.00663753	,		-0.006219291f,
		-0.005838916f,		-0.005491997f,		-0.005174743f,		-0.004883886f,
		-0.004616593f,		-0.0043704f,		-0.004143156f,		-0.003937975f
    },

    // B (0~40)
    {
		0,		0,	    	652.3710567f,		443.3679777f,		334.7852969f,
		268.2290866f,		223.2955489f,		190.9549507f,		166.5885976f,
		147.5875989f,		132.3670924f,		119.9089885f,		109.5296306f,
		100.7530574f,		93.23781048f,		86.73263585f,		81.04859656f,
		76.04091883f,		71.59682811f,		67.62719094f,		64.06064306f,
		60.83938249f,		57.91610206f,		55.25171718f,		52.81365852f,
		50.57457249f,		48.51132028f,		46.60419845f,		44.83632613f,
		43.19315848f,		41.66209738f,		40.23217724f,		38.89380971f,
		37.63857465f,		36.45904809f,		35.34865958f,		34.30157337f,
		33.31258882f,		32.37705657f,		31.49080763f,		30.67008327f
    }
};



/*!
    \brief      
    \param[in]  none
    \param[out] none
    \retval     none
*/
float32_t linerInterLookUp(uint16_t ad_rlst, const float32_t *table)
{
    float32_t  result = 0;
    uint16_t   index = 0;

    const float32_t  *p_row = table;
    const float32_t  *p_column = table + MAX_TABLE_AMOUNT;

    index = (uint16_t)((float32_t)ad_rlst * 0.01F);

    if(index > (MAX_TABLE_AMOUNT - 1))
    {
        index = MAX_TABLE_AMOUNT - 1;
    }

    result = *(p_row + index) * ad_rlst + *(p_column + index);

    return  result;
}



